/**
 * 
 */
package com.giventime.stormcoming.fights;

import com.giventime.stormcoming.units.StormUnit;


/**
 * @author ANDROUTA
 *
 */
public class FightHandler {

	public static FightResult fight(FightPremise fightPremise) {
		StormUnit unitA = fightPremise.getUnitA();
		StormUnit unitB = fightPremise.getUnitB();			
		unitA.performAttacks(unitB);
		if (unitB.isDead()) {
			unitA.victory(new FightResult(unitA, unitB));
			return null;
		}
		unitB.performAttacks(unitA);
		if (unitA.isDead()) {
			unitB.victory(new FightResult(unitB, unitA));
			return null;
		}
		return null;
	}
	
}
